
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?

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"
.

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

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.

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.

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?

Took a different approach: https://gist.github.com/Bogdanp/2eac8b4f7f1726af5b1bcce0a90e0fe5

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

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.

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.

@soegaard2 found this https://manual.audacityteam.org/man/sample_rates.html


Seems 44100 is used almost everywhere now.

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

@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)

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

Haven’t worked a lot with sound before, so I am just playing around.
Sonic Pi looks interesting: <https://sonic-pi.net/>

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

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?”

I am eying the pocket arcade …

Are they programmable?

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

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.

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

> 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

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.

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


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

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

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:

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

Agree.

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.

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

Downloading now! :grinning:

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


Thanks

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/


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

The Organelle looks really cool but I am very cheap.

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

equipment/instruments

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

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

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

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

True.

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


£547

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

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

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

I kinda like the idea of it being super portable.

yes it is small.

the OP-Z is tiny!

I think I have bigger TV remotes.

haha

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

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

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

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

I’ve added him to my playlist.

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

What sort of musician are you?

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.

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.”

Amateur :slightly_smiling_face:

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.

My 14yo son is learning guitar. Great instrument.

I’m jealous

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

haha

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

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?

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

I didn’t run it on the Racket binary.

Feel free to update https://github.com/racket/racket/wiki/How-to-get-started

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

and to have somewhere to point people to

I can log one

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

Ok

@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.

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

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

Okay, pushed a change, thanks.

macos racket 7.4

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

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

gives 44100

Unless of course my rsound is very old.

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

That I do not know - I’ll check.

I was running it from racket-mode btw.


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.

Ah. I see 44100 in the preferences.

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.

:slightly_smiling_face:

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))

thanks @jbclements

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)

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.

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

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)