popa.bogdanp
2019-12-7 12:36:16

Is it possible to write a require transformer that (even if only in a limited number of cases (i.e. when source files are available)) has access to the syntax objects of the things being imported? Do I need to re-expand the module and find the bindings myself or is there an easier way?


popa.bogdanp
2019-12-7 12:37:10

I would like to write a transformer that extracts “docstrings” from functions. Eg:

;; a.rkt (provide f) (define (f x) "Adds 1 to x" (add1 x)) ;; doc.scrbl @(require (for-doc "a.rkt")) @f-doc Something along these lines. Where f-doc would be a binding to the literal string "Adds 1 to x".


soegaard2
2019-12-7 12:51:38

So the idea is no extra requires are needed in “a.rkt”?


soegaard2
2019-12-7 12:53:46

Without something in “a.rkt” that exports the docstrings, I think the answer is no.

Consider the case where “a.rkt” is compiled to a zo-file. The compiler could easily throw away the docstrings - and when required from “doc.scrbl” there is nothing a require transformer can do.


popa.bogdanp
2019-12-7 13:17:20

Yep. I’d be fine with this only working on source modules, though I’d want to avoid expanding a module multiple times if it can be helped.


soegaard2
2019-12-7 14:21:03

The default sample rate is listed as 48000, but the text says 44100. And the latter makes more sense. Is this due to a different default sample rate on the build machine, or is it an oversight?

https://docs.racket-lang.org/rsound/index.html#%28def._%28%28lib._rsound%2Fmain..rkt%29._default-sample-rate%29%29


popa.bogdanp
2019-12-7 14:53:14

popa.bogdanp
2019-12-7 14:53:32

(I don’t really intend to use this for anything, just wanted to play around with the idea)


ryanc
2019-12-7 14:59:03

One way to go about this is to make a.rkt have a submodule that contains the values that you want. Then you can just require the submodule. (It’s trickier to catch the error if the submodule is not present.) You’d have to write a.rkt in a language that produces the submodule, though.


spdegabrielle
2019-12-7 16:08:42

44100 seems to be a really common sample rate. I have a couple of devices that sample at that rate, but I don’t know if it is any sort of standard.


spdegabrielle
2019-12-7 16:10:45

soegaard2
2019-12-7 16:11:19

soegaard2
2019-12-7 16:11:58

Seems 44100 is used almost everywhere now.


soegaard2
2019-12-7 16:12:29

Fun fact: 44100 = 2^2 * 3^2 * 5^2 * 7^2


spdegabrielle
2019-12-7 16:20:59

@soegaard2 thanks. Did not expect a Wikipedia article for a specific frequency. Is rsound good? What are you using it for? I was recently looking at https://github.com/jbclements/sonic-pi because of samaarons talk about sonic pi (and philosophy that closely matches what is expressed in htdp)


soegaard2
2019-12-7 16:24:09

I think rsound is an excellent interface to the system audio.


soegaard2
2019-12-7 16:24:16

Haven’t worked a lot with sound before, so I am just playing around.

Sonic Pi looks interesting: <https://sonic-pi.net/>


soegaard2
2019-12-7 16:27:51

I’ll look forward to seeing John’s version.


spdegabrielle
2019-12-7 16:28:44

I’ve recently become interested I’m synthesizers/electronic music and I bought a pocket sampler (po–33) and a synth based on the pure data dataflow programming language. Naturally my first thoughts are “can I do sonic-pi and pure data in DrRacket?”


soegaard2
2019-12-7 16:29:56

I am eying the pocket arcade …


soegaard2
2019-12-7 16:30:30

Are they programmable?


spdegabrielle
2019-12-7 16:31:46

You can set up patterns and play sets of patterns. Not what you would call programmable


soegaard2
2019-12-7 16:33:00

I watched a video with lft (which were incoved in making 2 or 3 of the pocket operators). He has some pretty interesting projects on his home page.


spdegabrielle
2019-12-7 16:33:37

I was looking at an OP-Z but ended up getting an organelle which is programmable https://www.critterandguitari.com/organelle


spdegabrielle
2019-12-7 16:34:49

> I watched a video with lft (which were incoved in making 2 or 3 of the pocket operators). Who is that? Please share video link

>He has some pretty interesting projects on his home page.

Please share homepage link


spdegabrielle
2019-12-7 16:36:54

A programmable Pocket Operator would be awesome. Or maybe it would be terrible. I’m not sure as I generally think everything should be programmable but it is usually a bad idea.


soegaard2
2019-12-7 16:40:03

The Organelle looks very versatile. Their video on the update is horrible though.



soegaard2
2019-12-7 16:40:53

One of this interesting projects: https://www.linusakesson.net/scene/craft/index.php


spdegabrielle
2019-12-7 16:41:03

very versatile. I’m completely out of my depth.


soegaard2
2019-12-7 16:43:46

I recently discovered the phenomenon of modular synths. (Youtube is great). The idea of building your own synthezier from smaller modules appeal to me. But then … then I discovered how much modules cost :disappointed:


spdegabrielle
2019-12-7 16:47:29

Virtual modular in pure data seems to be a better choice. (It’s free)


soegaard2
2019-12-7 16:49:00

Agree.


spdegabrielle
2019-12-7 16:50:30

Ive been meaning to try this https://www.automatonism.com/the-software > Automatonism is a modular synthesiser that runs in the open source programming language Pure Data.


soegaard2
2019-12-7 16:52:17

Do you have an ipad (or iphone)? If so check out “Synth One” .


spdegabrielle
2019-12-7 16:53:37

Downloading now! :grinning:


soegaard2
2019-12-7 17:03:56

It is worthwhile finding an introduction video on Youtube. Maybe this one?



spdegabrielle
2019-12-7 17:06:01

Thanks


spdegabrielle
2019-12-7 18:38:51

Hi @jbclements I found the command in the release notes didn’t work for raco. Instead I had to use sudo xattr -r -d com.apple.quarantine /Applications/Racket\ v7.5/


spdegabrielle
2019-12-7 18:43:34

samth
2019-12-7 18:46:30

I think you could have define generate the submodule with module+.


samdphillips
2019-12-7 19:02:04

The Organelle looks really cool but I am very cheap.


samdphillips
2019-12-7 19:03:16

Also I have a lot (at least to me, a non-professional musician) of equipment already.


samdphillips
2019-12-7 19:03:39

equipment/instruments


spdegabrielle
2019-12-7 19:03:54

just use puredata http://puredata.info on whatever computer you already own


spdegabrielle
2019-12-7 19:05:13

As far as I can glean the organelle is just a raspberry pi, with sound interface and midi interfaces, as speaker and a microphone


spdegabrielle
2019-12-7 19:05:55

I’m not even a non-professional musician. I’m just playing learning.


spdegabrielle
2019-12-7 19:07:00

And I justified the £500 purchase on the basis that and OP–1 costs >£1000


samdphillips
2019-12-7 19:07:19

True.


samdphillips
2019-12-7 19:09:01

Last I looked at Organelle it was over 700 GBP. I may have to check again.



spdegabrielle
2019-12-7 19:09:59

£547


samdphillips
2019-12-7 19:10:14

Oh wait, no I was think of OP–1. Which is pretty.


spdegabrielle
2019-12-7 19:10:18

or £500 for ‘b-stock’ whatever that is


spdegabrielle
2019-12-7 19:11:14

OP–1 is over £1000 new, and not programmable…I’d still love one but I cant justify that much money


samdphillips
2019-12-7 19:11:17

I kinda like the idea of it being super portable.


spdegabrielle
2019-12-7 19:11:56

yes it is small.


spdegabrielle
2019-12-7 19:12:06

the OP-Z is tiny!


spdegabrielle
2019-12-7 19:12:17

I think I have bigger TV remotes.


samdphillips
2019-12-7 19:12:26

haha


spdegabrielle
2019-12-7 19:13:12

You can guess I’d also like one of those but I’ve made my choice. (maybe next birthday)


samdphillips
2019-12-7 19:14:01

This Youtube channel is how I found the OP–1 https://www.youtube.com/user/yuriwongmusic


spdegabrielle
2019-12-7 19:14:29

Nice! I’m resisting the urge to install Racket on the Organelle…


samdphillips
2019-12-7 19:14:30

He does a lot of little sampling improv things. Probably heavily edited though.


spdegabrielle
2019-12-7 19:16:01

I’ve added him to my playlist.


spdegabrielle
2019-12-7 19:17:49

I heard of it when I first heard of the pocket operators, but only just got a PO–33 a month ago.


spdegabrielle
2019-12-7 19:18:25

What sort of musician are you?


deactivateduser60718
2019-12-7 19:24:44

Bit late to this. My read is that two really smart people built a bridge between two worlds that previously didn’t seem to go together. That effort deserves respect on the face of it.


deactivateduser60718
2019-12-7 19:27:25

I am interested in the politics/negotiation side of it. I’m seeing the beginnings of a debate between “We can have the best of both worlds” vs. “let me just have my world.”


samdphillips
2019-12-7 19:35:34

Amateur :slightly_smiling_face:


samdphillips
2019-12-7 19:39:23

guitars, ukuleles, a violin from high school/short lived uni career. Inherited an upright piano that my kids play occasionally. Someone gifted me an accordion that needs some repair. Odds and ends synth keyboard and drum machines.

Mostly play acoustic guitar since it can sit in my home office and I can pick it up and play it without a lot of prep.


spdegabrielle
2019-12-7 19:41:15

My 14yo son is learning guitar. Great instrument.


spdegabrielle
2019-12-7 19:41:45

I’m jealous


spdegabrielle
2019-12-7 19:42:14

I just play with the po–33 on the bus :rolling_on_the_floor_laughing:


samdphillips
2019-12-7 19:42:29

haha


spdegabrielle
2019-12-7 19:43:09

I also got the voice synth but I’m a bit lost with that one


jbclements
2019-12-7 20:47:41

Did you run the xattr command on raco? That probably won’t do anything useful, since raco is a shell script that calls ‘racket’. Did you run the xattr command on the racket binary?


jbclements
2019-12-7 20:49:02

@spdegabrielle the sonic-pi experimentation is just that… experimentation. Alas, I haven’t had time to work on this in the last… three years?


spdegabrielle
2019-12-7 20:49:09

I didn’t run it on the Racket binary.


spdegabrielle
2019-12-7 20:49:30

samth
2019-12-7 20:49:56

@jbclements allow me to again suggest a GH issue to track these problems


samth
2019-12-7 20:50:04

and to have somewhere to point people to


spdegabrielle
2019-12-7 20:50:28

I can log one


samth
2019-12-7 20:50:59

I think it would be best if @jbclements started it because he’s done the most with Catalina issues


spdegabrielle
2019-12-7 20:51:11

Ok


jbclements
2019-12-7 21:08:26

@soegaard2 Not a typo, the default sample rate is 48000. It looks like I made this change in 2016, when I made it possible to choose either 48k or 44.1k as the default sample rate. I think I felt like the world was heading in this direction. You can also set it to 44.1k.


jbclements
2019-12-7 21:08:43

But I should update the text you reference to also use 48K, yes.


soegaard2
2019-12-7 21:10:05

When I call (default-sample-rate) I get 44100.


jbclements
2019-12-7 21:10:07

Okay, pushed a change, thanks.


soegaard2
2019-12-7 21:10:26

macos racket 7.4


jbclements
2019-12-7 21:10:45

Is it possible you set the default-sample-rate preference yourself? Um… or maybe I did :slightly_smiling_face:


soegaard2
2019-12-7 21:12:11

Nope. #lang racket (require rsound) (default-sample-rate)


soegaard2
2019-12-7 21:12:17

gives 44100


soegaard2
2019-12-7 21:12:42

Unless of course my rsound is very old.


jbclements
2019-12-7 21:12:48

Right, but do you have a “plt:framework-pref:rsound:default-frame-rate” setting in your preferences?


soegaard2
2019-12-7 21:13:16

That I do not know - I’ll check.


soegaard2
2019-12-7 21:13:45

I was running it from racket-mode btw.


soegaard2
2019-12-7 21:15:18

jbclements
2019-12-7 21:15:34

I’m looking at the code, and it looks to me like the uber-default might be 44.1k. I’m not exactly sure how to document this, though.


soegaard2
2019-12-7 21:15:50

Ah. I see 44100 in the preferences.


jbclements
2019-12-7 21:16:54

Well, that pref might have been written by running rsound with no pref. Honestly, I think the easiest change might just be to remove any mention of a built-in value for the default sample rate.


soegaard2
2019-12-7 21:17:07

:slightly_smiling_face:


soegaard2
2019-12-7 21:25:48

Btw - if I read the code for build-sound correctly, it calls the generator twice per frame. Having a generator with side effects (and only needing mono) I got funny results before I discovered this. The documentation of build-sound just says that the left and right channel will be identical (which I read as the same value would be used twice).

#lang racket (require rsound) (default-sample-rate) (build-sound 10 (λ (n) (displayln n) 1.0))


spdegabrielle
2019-12-7 22:50:19

thanks @jbclements


rokitna
2019-12-8 03:10:01

Yes, it’s that increasing divide that I’m afraid of, and it’s the reason I’m speaking up. It seems like everyone involved here (and most people in the HN thread) have good-faith ideas of what the best designs would be like. Nevertheles, some people are trying to help out by explaining why they believe in a less extensible form of prefix notation, and they’re getting facepalmed. That’s unnecessary disrespect, and I don’t think it’s a habit of a collaborative community that might actually stand a chance of finding “the best of both worlds.”

Unfortunately, designing a good extensible platform isn’t as simple as trying to cater to every single possibility (which isn’t to say that’s simple either). It’s also about helping people manage the explosion of forked ecosystems that can emerge from those extensions. With good modularity, two independently developed extensions can be used together without spending extra effort to glue them.

If two independently developed extensions are both parenthesized prefix operators, then the whole question of their relative precedence doesn’t need to be answered, which makes gluing them together more trivial. In other words, a culture based on prefix notation automatically bridges its subcommunities, and I think the people advocating for it are really honestly engaging in the bridge-building spirit.

(edited to split up a run-on sentence)


sorawee
2019-12-8 07:52:34

Is there a way to make for support different values for different element? For example, I want to write something like this:

#lang racket (require racket/generator) (define gen (generator () (yield 1 2) (yield 3 4) (yield 5 6 7))) (for ([(a b) (in-producer gen)]) (println a) (println b)) The (a b) part is obviously incorrect, but there’s really nothing else I can replace with to make it correct.


sorawee
2019-12-8 07:54:11

I guess what I’m looking for is something equivalent of call-with-values that operates on a sequence but acts on its element.


sorawee
2019-12-8 07:54:58

So that I can instead write:

#lang racket (require racket/generator) (define gen (generator () (yield 1 2) (yield 3 4) (yield 5 6 7))) (for ([lst (normalize-arity (in-producer gen))]) lst)