|Welcome to CS1315. Click on the python to add comments.|
|This page removed for FERPA compliance|
HW4- Fall 2007 Questions
Post your quesitons here.
I understand that I need to manipulate 5 of my 6 sounds, but i'm having difficulty shortening the length of a sound. I can't find any code in my notes or on the coweb that shortens a sound. How can i figure this out?
What does it mean when it says we should have six sounds but only use some samples from three? Does that mean we have six sounds but we only alter three of them?
so we use all 6 sounds we choose but we can only use the "whole" sound from 3 of them..?
|No, it means that you must use a portion of three of them (not the whole sound). It also states that you must alter at least 5 of them. Thanks! Brittany Duncan|
If I wanted to use only a portion of the sound, would I use the function splicing to do it?
|Right, but you can use REMOVED than 6 sounds if you want. Thanks! Brittany Duncan|
For the alterations we must do to 5 sounds, do they all have to be different or can we, say, increase the amplitude for one and decrease the amplitude for another and that will be 2 different modifications?
|That is for you to figure out, the idea is for you to write your own function to accomplish these tasks. Thanks! Brittany Duncan|
do we have to submit the sound files if we use the sounds provided on the hw4 page?
|You can both increase and decrease amplitude, that would count as two alterations. Thanks! Brittany Duncan|
What does it mean when I get this error for makeSound on certain sound files?
The error SoundException has occured
SoundException: Exception during load of file
|Are these custom sounds, or ones Brittany supplied? They may not be at a sample rate JES is prepared to deal with. Student5493|
When it says we should only use portions of three, does it matter if we change the entire sound first and copy only part of the changed sound into our empty sound after the change, rather than taking a portion of the sound and then changing only that portion?
|Nope, you can change the whole song or only part and I don't care as long as the final version has 3 shortened sounds. Thanks! Brittany Duncan|
Here's my problem. I have all my sound files in a folder on my desktop, but when I run my program it says that my sound files do not exist. It says: "There is no file at C:\Documents and Settings...etc...splash little.wav" and then says Inappropriate Argument value (of correct type). What should I do?
|Is the folder path pointing to the correct location? Like, it's saying there's no file there...is there in fact a file? If you pulled it off of the coweb, note the spelling, as that particular file is 'spalsh', because Brittany presumably made a typo. Student5493|
I would think that if they're on your desktop, they're probably not going to open with Documents and Settings.
In XP, the user's desktop is at C:/Documents and Settings/[user name]/Desktop. So the path is right. I would guess that the spaces in the path are screwing it up - try putting your sound files somewhere in the drive root, like c:/MySounds/, then SetMediaPath'ing to that and trying it again.
Some of the sounds posted on the HW4 page don't work in JES when manipulated:
And maybe others. I know it's not my function because Bobby checked it, and it works on other sounds.
|Thanks for the heads up. If Brittany checked them, it may be different versions of JES, different names, whatever. If others have problems, hopefully they'll see this. Student5493|
Just curious Brittany Duncan, why do you always have a "Thanks!" at the end of you posts? Shouldn't we be the ones thanking you for you help?
I am getting an error of: >>> play(spookySound())
|That is just how I sign my posts, I guess you could always thank me for the help, but I am thanking you for being such great, polite students. You're Welcome! Brittany Duncan :-P|
play(sound): Input is not a sound.
The error was:
Inappropriate argument value (of correct type).
An error occurred attempting to pass an argument to a function.
Why would it say this?
So my program has been running for over 10 minutes after I loaded it and did play(spookySound()) and it still hasn't played any sound or given any error. Is this normal? How long should it take to make sound?
|Did you return your sound? If not, then because it is not receiving a sound. Thanks! Brittany Duncan|
Some of the functions, specifically the backwards function ask for (filename) as a input parameter. What is the difference between filename and sound?
|If you don't understand how to use the functions, you shouldn't use them. In any case, the response below mine is correct. If you need REMOVED help, please see a TA. Thanks! Brittany Duncan|
The ones that need a filename are typically doing something to the sound that might change things in a non-linear sort of way - if you ran the reversing thing on a sound, modifying that sound as you went, you'd end up with a sound that was reversed for the first half and normal for the second, since, as the loop got closer to the end, it would be taking samples from the beginning, which would in turn have already been taken from the original end.
Long story short, the functions take a filename if they need multiple copies of a sound for modifying it discontinuously, and a sound if they don't.
whats the difference between the blend and merge functions listed in our book?
If we use custom sounds, what sample rate should they be at in order for JES to be able to process them?
does mirroring a sound count as using only some samples from the sound?
when we use only some samples of the whole sound, do we have to come up with a different function to do that for each of the 3 sounds? or, for example, could we just mirror all three sounds?
|No. You should only copy a portion of the song to a canvas, then change it in order to recieve credit for the sampling part of the assignment. Thanks! Brittany Duncan|
|You can use the same function to copy portions of the sound, but not mirroring. Thanks! Brittany Duncan|
I think I just took the normalizing function straight from the book but it's not working...?
for s in getSamples(sound):
for s in getSamples(sound):
I don't see where to submit HW 4 on T-square...there is no option for it on Auto submissions. What should we do?
|I think that the "louder =" line is wrong. You should multiply the value of each sample by the multiplier and then set the sample to that value. Thanks! Brittany Duncan|
whats the differences between mirroring and reversing?
Should we use blockingPlay to play one sound after another or do it a different way?
|There is no difference between mirroring a sound and reversing a sound. We sometimes use "mirroring" to refer to sounds, because that is the term we used to Mirror a picture and both of these functions work similarly. I hope this helps - please let me know if anything is unclear. Student3703|
When I'm making my new sound by merely copying the originals without altering anything, and I try to play it, it's barely audible. I have to turn the volume all the way up to even realize it's playing. I'm looking at the samples, and they're the same as the original, but the volume is a lot lower. Any idea why?
| you can use blockingPlay to play one sound after another, HOWEVER you should NOT do this for your assignment! The idea is for you to copy information from the sounds that you are using to another sound, so you are actually creating a new sound and returning it. If you use play in the function you turn in, point will probably be deducted! Student3703|
|Never mind, I figured it out. Apparently, in JES, if the bitrate of the wav file is less than 352kbps, the volume dies when you copy the samples. Not a TA|
| Dear Not-a-TA, You are correct in your assumption. JES will essentially play any wav file, but when you try to copy a wav file that has a sampling rate that is not 22,050 samples per second or Hertz, the sound will play really quietly so you will have to normalize it to hear anything. I recommend you try your best to stick to the 22050 sampling rate. If you really want to use a sound that's say half of that you can use some clever manipulating to make it work. For a sound that is originally 11025 Samples/second try copying the entire thing to an empty sound, halfing the freq, then normalizing it. Hope this helps, REMOVEDt me know if you need anything else! Student3703|
can you use the montage function, like from homework 2, to play the sounds together????
| Hmm...sounds like someone may very well be on a very good track... Student3703|
I took the code from the 'slides and code' page for increasing volume, but it won't work... what's wrong with it? (and yes, 'sound3' is defined properly... it works for my other functions)
for sample in getSamples(sound3):
value = getSample(sample)
| What are you returning? Is multiplying the sample value by 2 really that good of an idea? What if multiplying by 2 sends the sample value out of range? Hope this helps, REMOVEDt me know if you need anything else! Student3703|
when i play my spookySound function, only the first sound plays and then it stops. What could i be doing wrong?
| Maybe you are returning the wrong sound (I did that myself the other day...). Maybe you have the play function in your code. Maybe your splicing/copying code is broken. Right now those are all the ideas that I have - It's kinda hard to tell you without seeing your code. But don't post your code! If you trouble shoot these areas and are still having problems come see a TA during office hours tomorrow. If no one's office hours work for you tomorrow try e-mailing one of us with your code. Hope this helps let me know if you need anything else Student3703|
Hey. I am trying to set the destination for my splice code, but I can't specify what sound I paste it into. In my code I have this:
sound1 = makeSound(getMediaPath("sound1.wav"))
sound2 = makeSound(getMediaPath("sound2.wav"))
sound3 = makeSound(getMediaPath("sound3.wav"))
sound4 = makeSound(getMediaPath("sound4.wav"))
sound5 = makeSound(getMediaPath("sound5.wav"))
sound6 = makeEmptySound(120)
and the splice contains this:
source = (sound)
dest = (sound6)
destSample = 17408
It gives me an error on the sound6 line for the dest. Any suggestions on what I can do?
| In the future, please remember to use the CODE tags! As it appears right now, it looks like you have a spacing error. If this isn't the issue please be REMOVED specific and post the error message JES is giving you. Hope this helps let me know if you need anything else. Student3703|
For some reason in my code, it is jumping ahead to the last function (which has a Half frequency function applied to it) before doing everything else that is supposed to go before it. The rest of the code plays in the order it is supposed to except this one piece that jumps ahead. Any idea why?
| Indentation? That's the function you are telling it to run (ie the order is off in you main function maybe?)? This is another one of those things that's a bit hard to diagnose without seeing the code...If you check these areas and nothing seems wrong, either go to office hours tomorrow or send your code to a ta Student3703|
What sort of thing do you use so that JES doesn't start all of your sounds at the same time and instead plays them in a particular order? Maybe a hint?
| blockingPlay() is the function you are looking for, but please DO NOT USE THIS IN YOUR FUNCTION! You will lose Points!|
look at blockingSound() something. If you go to the help section in JES, under sounds, there is a list of functions there.
:'(... where did all the TA's go? ... my ques. has been left unanswered for a while now...
| Don't cry! :-( I promise we are doing our best! ;-p Student3703|
assuming we do use play in our main function but not our secondary functions, how many points will we lose?
|That depends. It's pretty safe to say if you remove the 'play' from your function, and it doesn't work, and you do what we are going to do to grade your homework (see the homework 4 page) and you get some sort of error, you could stand to lose A LOT of points. As in, depending on what is wrong, you could potentially receive a faiiling grade on the assignment. Please don't let this happen to you! If you need help come to someone's office hours tomorrow or e-mail one of us. We can sit down and work through your code so you can do well on the assignment! All of the TAs are here to help you, so please, let us! Student3703|
In Jes it is saying all my lines have spacing errors but they don't and when I align all my code in one line it says it is correct. Its acting like I shouldn't have any tabs/indents in my code but I know I am supposed to have them.
| How odd. The only time I have something similar happen is when I copy and pasted code from either powerpoint of word - in that case you would have to delete all the spacing and put it back in. If this is not the case, then either come to office hour tomorrow or e-mail your code to one of us. Hope this helps, let me know if you need anything else Student3703|
When we change parts of sounds:
1. do we change only some samples of a sound but play the whole thing (i.e. make the first half louder and keep the second half the same)?
2. or do we just use a piece of the sound without having to modify it (i.e. take only the first half of the sound and use it as it is)?
3. or do we have to take a section of the sound AND modify it?
| Ok, so you have to use at least 6 sounds. REMOVEDt's say, for examples sake, you only use 6. You can only use the entire sound (ie all the samples) for three of them. Also, you have to perform at least 5 different modifications (normalize, reverse, increasing frequency, etc.). It would probably sound better if you did this to the individual sounds before copying them to the final sound, but the order is indeed up to you. I hope this helps, let me know if you need anything else Student3703|
okay, I get that we have to change sounds in 5 different ways, but I don't understand what the requirements are exactly for when we don't have to change the entire sound. I have way REMOVED than 6 sounds. What if I modify whole sounds in those 5 different ways? Does this mean I don't have to modify when I only take pieces of a whole sound? Or is the assignment asking me to both pull out a piece from the original sound AND modify it?
| As far as the modification portion of the assignment goes, you can do it either way. As far as the "only using part of three", you can either leave those three alone (ie just copy a portion to your final sound) or you can change it then copy it. It's entirely up to you. Given that you have way REMOVED than 6 sounds, you could very well modify 5 whole sounds and then only copy part of three entirely different sounds. Don't get too bogged down in the instructions - I mean make sure you are meeting the basic requirements, but the instructions are designed to give you a bit of creative freedom. I hope I answered your question, if not just let me know. Student3703|
I believe I have successfully made my functions and program. .but i am unable to play it. How do I play my sound? Am I suppose to save it in a particular format, then open it? (i looked through the notes and couldnt find any answers. Please Help!! Thanks
| Make sure at the end of your main function (spookySound()), make sure you are returning your final sound. Load the program, and type|
into the command line. This should play your sound. If you are trying to figure out how to save the final sound ot your harddrive, try out the "writeSoundTo" function. I'll give you a hint - it works a lot like writePictureTo... Hope this helps, let me know if you need anything else. Student3703|
I keep getting this error inside my for loops when blending two sounds with a delay:
The error SoundException has occured
SoundException: You are trying to access the sample at index: 25470, but the last valid index is at 25469
what does this mean?
I am already using the range code, and i have added 1 to the top range but the error still persists?!
|It means exactly what it says. Your loop attempts to go one sample too far. If you are using getSamples to return a list of samples to loop through, you may be using a previous version of JES with a known bug. Look at the alternative way to do this using a list of sample indices, which definitely works. The code is posted on the code/slides page. If you are already looping through a list of numbers (using range), then you have a simple off-by-one error. Add one to the top end of the range and try it again. Colin Potts|
Some of the changes to the sound aren't obvious by listening to it.. will the TA's just look at the program to judge whether or not our changes are acceptable? (i.e. decrease sound, increase sound, increase frequency.. etc..)
|Your TA will probably look at both. If he/she does not, and penalizes you for it, then contact them, and ask them to review your homework, pointing out that their deducting points for that reason was incorrect. If they look back, find you had some functions that weren't obvious (like normalize, they'll give you the points back. Student5493|
Is the splice code not posted?!
how do you create your final sound into a wave to post it in the gallery? i tried the writeSoundTo() but it didn't seem to create the file.
|In your book I believe. There are other ways to do it though. Student5493|
|It's extra credit to do that, so it's unlikely you'll receive help with it. It's for you to figure out. Student5493 |
How do you use a function without parameters in another function? The splicing code doesn't take in paramaters.
Nevermind! ; )
When we submit on t-squre, if we only used sounds provided on the hw page, do we need to upload them with our code?
why is it taking forever for my program to load. it's been like 5 minutes. am I doing something wrong? I have maybe 45 seconds of sound at this point...
for source in range(1,getREMOVEDngth(sound1)-.005):
setSampleValueAt(target, index, value)
index=index + 1
this keeps giving mr a spacing error for the value line. There is no error only when I erase the indentation to the level of the for loop. It seems like Jython isn't recognizing the need fo indentation after the for.
what should I do????
for those of you who have figured out how to make there be an audible sound when there just appears to be silence, do you have any hints? my changeVolume function I took from the book only seems to make my program stop working, but this is what is looks like:
for sample in getSamples(sound):
I'm completely stumped here:
for destIndex in range (1, getREMOVEDngth(sound)+1):
sample = getSampleValueAt(sound, int(srcIndex))
setSampleValueAt(sound, destIndex, sample)
srcIndex = srcIndex + .5
THe output sound is just completely blank; I have no idea why it does this. Any ideas?
How do we correctly save our sounds as a wav file?
Link to this Page