Congrats!
Putting in my pre-order now for the philfrei “play wavs backwards” vst now
Congrats!
Putting in my pre-order now for the philfrei “play wavs backwards” vst now
Got some crude stretching effects to work. It sounds pretty good. The GUI is crude. Linear interpolation works! ;D
Nice work!
Send us a link when you have something substantial.
http://www.hexara.com/ClipScratcher.jar
You can download the above jar. It’s only 24kb, and should have the source code embedded. It is misnamed, as it is hard to manipulate it to get a true “scratch” effect that one can do with a turntable. But I have to admit, I’m not interested in pursuing that aspect. There are already quite a few excellent tools out there that can do that sort of thing. (I want to get on with implementing JOrbis, etc.)
To run, click on the jar file. This should give you the following GUI:
http://www.hexara.com/ClipScratcherGUI.JPG
Load a wav via the dropdown “File” menu on the top left. Once a wav is loaded, when you mouse over the rectangle, the green label will display your mouse’s X-position, in terms of seconds. The rectangle’s x-length is set to correspond to the duration of the wav.
“Play” button will play the entire wav normally. “Yalp” button will play the entire wav in reverse. Multiple clicks of either will launch overlapping sounds. There is no way to stop a sound.
Click inside the rectangle and an orange cursor will appear. It’s location in seconds is displayed in the blue box. When you hold the mousedown while there is a cursor, the cursor will move towards the x-location of the mouse. When you release the mousedown, the cursor disappears and the sound stops. The next click will place a new cursor.
I have no claims that the code is optimal or totally clean (for example, it is possible to run a sound past the beginning or end and get an exception), am just pleased that it works, doing (a) translation of wav data to float & back to wav for playback, (b) linear interpolation, allowing bidirectional speedup/slowdown. But I think it helps demonstrate that javax.audio.sampled is capable of a lot more! ;D
All clips I played were very scratchy. Plus I was confused on what to do
Dang. Well that is disappointing. I mean about the scratchiness. I know the GUI is bogus.
I’m not sure about how to figure this out. Maybe you can try loading this sound:
http://www.hexara.com/Audio/e4.wav
I KNOW that it plays cleanly on my system. It could be that your source sounds are of a different flavor of .wav than the specific one that I have encoded.
Also, if you are willing, you could post an example of a .wav that was scratchy, I could try it out at my end.
For the GUI: first downmouse in the rectangle places a cursor, first release does nothing, second downmouse starts playback, the rate being determined by the x-distance between the mouse and the cursor (farther away makes it faster, closer makes it slower) and the second release ends playback and removes the cursor.
Thanks for giving it a try!
This .wav file played fine for me. Maybe the one I used wasn’t quite “clean”
That is a relief!
There are lots of possibilities. It could be a 24-bit encoding rather than 16-bit. That is the most common thing that happens. 24-bit is of a higher quality, but 16-bit is more common, and more commonly supported.
I think one of the reasons that sound programs get so large is that there are so many different possible encodings and codecs to support.
It doesn’t say what encoding it is but I bet it’s 24-bit.
Well done,
This worked well for me. I tried it with a few different loops before it tried it with one of my ambient compositions hitting play and yalp a bunch of times at varying intervals to create a swirling morphing sound, you have not set a boolean on is music playing(intentional or not yet implemented) but it was perfect for ambient weirdness.
Cool! I wish I could hear some of what you are up to. I’m not clear on what you are thinking of in terms of a boolean. I’m also not sure I want to invest a lot more time in this until I get it working with some sort of compressed sound as input.
I just mean you can spam the play button on your app and it plays multiple times (not sure if you wanted this feature or not?). I have been using slick for my sound, but im sure there is something similar to,
if(music.isPlaying())
playButton = notClickable;
yalpButton = notClickable;
It was deliberate. I purposely wrote the code so that it could handle overlapping playbacks: each is launched in its own thread. I see an earlier post where you wrote of problems calling code that does playback when a play was already in progress, and you use a boolean to prevent this. The boolean could also be used in that context to stop and reset the sound, restart from the beginning. But I find it generally annoying when sounds are cut off prematurely. I want them to at least tail off in a natural fashion, and this requires overlap–thus, separate threads.
The total number of overlapping plays possible will be limited by how much RAM you have available. But when I had an early “windchime” experiment up on JConsole, I found I could get like 100 simultaneous wav files playing at the same time in one app. The background “windchime” in Hexara has a random factor, but between the background pad and triggered sounds and the background chimes, it will often have something like 10 sounds playing at once.
Yes! This style of plug-in would be perfect for generating a wind chime sound on the fly.
(don’t forget that your sound thread should have a high priority, just my 2 cents)