Up Music Loop

0 views
Skip to first unread message

Maribeth Seagers

unread,
Aug 5, 2024, 1:01:34 AM8/5/24
to abtramporte
Posts in the debugging category need to have the following pieces of information included in order to help other teachers or our moderator team best help you. Feel free to delete everything in brackets before posting your request for debugging help.]

It looks like the problem is that the draw loop is running the winnerWinner or endGame function over and over, so the sound is playing over and over. Can you try doing something similar to how you saved the game state in order to create the start screen? For example, have a won variable that is originally set to false. Then, inside the winnerWinner function, instead of just checking to see whether (score >= 10), check for ((score >= 10) && (won ==false)). Then set won to true inside that code.


@elizabeth_admin A student in my class was having this same issue with the sound looping when she needed to finish out a winning and losing page. I tried this code suggestion for her to try to fix the issue and it did not solve the problem. I wanted to pass that along. I am sorry. However, there was some promise with the World.seconds code block. The nugget though is that it brought up an error message at the end even though it kind of worked to help improve the sound issues, it slowed down the sound and made it comprehensible and pleasant sounding at the very least. Can you please take a look at her Winning and Losing page code to give us some assistance here as we continue to try to solve this winning/losing page problem? Thanks. The project simulation of her project code is here in Gamelab. Thank you


We are trying to create a winning and losing screen with specific finale sound clips assigned to each of them. The issue is that after the if statement enters the phase of those states it loops the sound into a frenetic distortion that plays forever and sounds terrible. We tried the code from Elizabeth to stop it and could not get it to stop the phenomenon.


If you play the code it also helps to see in real-time. If you want I can remove the World.seconds block and then resend the link for you to experience the difference. Please let me know if you want me to do that? There is a big difference in the quality of the ending pages going back to being distorted.


RESULTS The goal was to try to bounce the final page to a function that does not contain a sound clip to bounce the sound clip to a STOP page. I am trying anything at this point, however, the game sound clip kept playing on distorted loop as usual at the end.


In addition, use var soundPlay = true; to turn off the looping of the underwater sounds in draw loop the middle of the game. Also, carefully layer the middle stop sound blocks in sequence so that the sound clips do not run into each other.


@melynn The work your class did over Spring break will pay off for many other classes because it was a God send for fixing this problem. You are being modest, because it was by no means super simple. It does not exist in the code.org documentation, it is a creative new way of using soundPlay = soundPlay+1; to create a sort of playSound seconds in an if statement to create a brand new solution of limiting time on sound loops.


This is the first time I have found this type of code on any forum, I have looked through all the other forums threads on stopping sound loops - and I am so thankful I found this! It is complex and requires a double layer of nested if statements. The way you demonstrated it in a simple way was helpful it will likely help other classes in the future.


at the end of the 6 minutes and 15 seconds I want to track to replay and keep replaying until the end of the mission.



Now I would specifically like it to be classed as a music track so players can adjust the volume using their music volume controls instead of sound effect controls.


Note, if this is for multiplayer mission, some things may differ - MP can make simple things difficult, so it's important to point, if this is SP or MP. My assumption always is SP. Not sure about MP - ask someone else in such case.


Sleeping for 675 seconds does not guarantee that after 675 seconds the scope will end, it could be 765 seconds for example or 699 or.. this is very very very unreliable and I would advise not to do this. Instead there is a dedicated Music EH that can execute given code EXACTLY when music stops


So far worked just fine for me. May be enough for simplicity - why to complicate. From the other hand, music EH sometimes failed for me in my tests, so not sure, what's more reliable. Let him try simplier way first.


With "sleep method" obviously the lenght of the sleep should be adjusted to fit the song length. For music EH way - not required. In this way code awaits specifically for the end of playing music instead of awaiting given amount of time. Exemplary approach would be then:


Oh boy, you guys have posted a lot of information and I'm not sure I'm any more clear on what to do than before.



The "track" (it isn't music but ambient sound) i want to be controlled by the players music volume not their sound effects volume.


I want the track to start 3 minutes after the mission has started and repeat until the end of the mission. Terminating the track is not necessary I just need it to efficiently and reliably keep playing after all like I said it is ambient sounds.


Because "MusicStop" awaits, till... music stops :) before will run contained code, so you have to run the music once after adding this music EH, or "musicStop" will have no opportunity to be activated due to lack of music playing.


I've written a simple script for looping and randomizing music. It works really well and you can just execute it again with different arguments so you can use it in triggers to change between calm/suspicious/battle music... etc. It's old, so the writing is messy but it works.


Your approach worked well for my MP3 music. I think it can be a good practice to just use finished signal for looping music for any kind of AudioStreamPlayer node because it makes the whole process format independent.


My problem is that the music doesn't play. Error: java.io.IOException: could not create audio stream from input stream. What does it mean? The type of my file is Microsoft Wave Sound Format and its size is 796kb. May I know what I am doing wrong? Your suggestions will be highly appreciated. Thank you in advance.


so i've been trying to do this myself and i found how to implement it finallyThis particular code chooses a track at random from the directory given and then loop choosing another random fileThe loop is in the startPlayback() which is called from the run() method, as this is a seperate thread this will not stop program execution


My guess is that the wav file has been encoded in a format the AudioStream class doesn't understand. I couldn't find the docs for the class (??) but I would try another file that isn't Microsoft Wave Sound. Again, don't know the specifics of that encoding but it being Microsoft it's probably proprietary and therefore not in the Sun implementation of the AudioStream.


In music, a loop is a repeating section of sound material. Short sections can be repeated to create ostinato patterns. Longer sections can also be repeated: for example, a player might loop what they play on an entire verse of a song in order to then play along with it, accompanying themselves.


Loops are supplied in either MIDI or Audio file formats such as WAV, REX2, AIFF and MP3. Musicians play loops by triggering the start of the musical sequence by using a MIDI controller such as an Ableton Push or a Native Instruments MASCHINE.


While repetition is used in the music of all cultures, the first musicians to use loops in the sense meant by this article were musique concrete and electroacoustic music pioneers of the 1940s, such as Pierre Schaeffer, Halim El-Dabh,[5] Pierre Henry, Edgard Varse and Karlheinz Stockhausen. [6] These composers used tape loops on reel-to-reel machines, manipulating pre-recorded sounds to make new works. In turn, El-Dabh's music influenced Frank Zappa's use of tape loops in the mid-1960s.[7]


Terry Riley is a seminal composer and performer of the loop- and ostinato-based music who began using tape loops in 1960. For his 1963 piece Music for The Gift he devised a hardware looper that he named the Time Lag Accumulator, consisting of two tape recorders linked together, which he used to loop and manipulate trumpet player Chet Baker and his band. His 1964 composition In C, an early example of what would later be called minimalism, consists of 53 repeated melodic phrases (loops) performed live by an ensemble. "Poppy Nogood and the Phantom Band", the B-side of his influential 1969 album A Rainbow in Curved Air uses tape loops of his electric organ and soprano saxophone to create electronic music that contains surprises as well as hypnotic repetition. [citation needed]


Another effective use of tape loops was Jamaican dub music in the 1960s. Dub producer King Tubby used tape loops in his productions while improvising with homemade delay units. Another dub producer, Sylvan Morris, developed a slapback echo effect by using both mechanical and handmade tape loops. These techniques were later adopted by hip hop musicians in the 1970s.[8] Grandmaster Flash's turntablism is an early example in hip hop.[citation needed]


The use of pre-recorded, digitally-sampled loops in popular music dates back to Japanese electronic music band Yellow Magic Orchestra,[10] who released one of the first albums to feature mostly samples and loops, 1981's Technodelic.[11] Their approach to sampling was a precursor to the contemporary approach of constructing music by cutting fragments of sounds and looping them using computer technology.[10] The album was produced using Toshiba-EMI's LMD-649 digital PCM sampler, which engineer Kenji Murata custom-built for YMO.[12]

3a8082e126
Reply all
Reply to author
Forward
0 new messages