sample pitch

51 views
Skip to first unread message

loann largeron

unread,
Apr 15, 2020, 6:53:16 PM4/15/20
to beadsproject
Hello,
For a school project, I try to make a program where you can pitch any sample of an instrument, so that I just have to enter a frequency and the sample will sound the same note as a Waveplayer with the same frequency. (considering all sample will be on the same pitch on the beginning)
I have seen that there is something called setPitch in GranularSampler but it demands an Ugen and I don't see what I can do to pitch the sample with this method.

Is it possible to do that with beads (as in a DAW like ableton for example) ?
Thank you !

Ollie Bown

unread,
Apr 15, 2020, 7:11:49 PM4/15/20
to beadsp...@googlegroups.com
You can do granularSamplePlayer.getPitch().setValue(x);

Note however that what this actually sets is a playback pitch ratio. Setting 1 will mean “play back at the original pitch”. Setting 2 will mean “play back one octave up”. Setting 0.5 will mean “play back one octave down”. 

It’s not trivial to get a recorded sample to play back at a specific pitch unless you know what the pitch of the sound you sampled is. If you record a middle C on a piano, then you can calculate the correct pitch ratio to pitch it to other notes. If you don’t know the pitch of the sound you’d need to automate some pitch analysis on it to work it out.

Best,

Ollie

--
You received this message because you are subscribed to the Google Groups "beadsproject" group.
To unsubscribe from this group and stop receiving emails from it, send an email to beadsproject...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/beadsproject/9159aa1c-77e1-4f1a-b0c4-bb1b3c6ccf39%40googlegroups.com.

loann largeron

unread,
May 13, 2020, 9:09:15 AM5/13/20
to beadsproject
Hello again, I've finished my project yet and it's working perfectly on eclipse, but I have to make a runnable jar file out of this project, and when I do it, it produces no sound at all.
Is there any way to export a project that uses beads into a runnable jar ?
( for this project I also use a lot of sample, I don't know if it changes anything, as the samples must be exported also in the jar)

Thank you !

Loann

Ollie Bown

unread,
May 13, 2020, 6:39:19 PM5/13/20
to beadsp...@googlegroups.com
Once you have the runnable jar, if you run it from the commandline (java -jar myjar.jar) then you will still be able to see the console output and any exceptions that are thrown. So first question is: have you done that and do you see any exceptions? Yes it is very likely if you haven’t planned ahead regarding loading samples that your program will not find those samples. You can embed them in the jar file but this can be complicated. The laziest alternative is to hard-code an absolute path to the files. An alternative might be a relative path from the jar file.

Best,
Ollie

--
You received this message because you are subscribed to the Google Groups "beadsproject" group.
To unsubscribe from this group and stop receiving emails from it, send an email to beadsproject...@googlegroups.com.

loann largeron

unread,
May 15, 2020, 12:08:26 PM5/15/20
to beadsproject
Thanks, I did exactly what you said and I saw a nullPointerExeption in sampleplayer, so the problem was definitely with the sample path, so I coded an absolute path to the samples and it worked perfectly ! :)

Thank you for this amazing library

Loann

Ollie Bown

unread,
May 16, 2020, 6:48:00 PM5/16/20
to beadsp...@googlegroups.com
Cool, please share your work to this list! We’re always interested to know what people are doing with Beads.

--
You received this message because you are subscribed to the Google Groups "beadsproject" group.
To unsubscribe from this group and stop receiving emails from it, send an email to beadsproject...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages