Skip to content

Commit

Permalink
Update audio_pitcher.py
Browse files Browse the repository at this point in the history
  • Loading branch information
sebibi07 authored Jul 22, 2018
1 parent baca3d5 commit 0ff695e
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions audio_pitcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,8 @@ def pitcher():
for element in octaves:
new_sample_rate = int(sound.frame_rate * (2.0 ** octaves))

# keep the same samples but tell the computer they ought to be played at the
# new, higher sample rate. This file sounds like a chipmunk but has a weird sample rate.
hipitch_sound = sound._spawn(sound.raw_data, overrides={'frame_rate': new_sample_rate})

# now we just convert it to a common sample rate (44.1k - standard audio CD) to
# make sure it works in regular audio players. Other than potentially losing audio quality (if
# you set it too low - 44.1k is plenty) this should now noticeable change how the audio sounds.
hipitch_sound = hipitch_sound.set_frame_rate(44100)
#sound.export(str("./wav/"+str(name)), format="wav")
hipitch_sound.export(str("./wav/"+name+"_pitched_"+str(octaves)+".wav"), format="wav")
Expand All @@ -37,4 +32,4 @@ def pitcher():

print("starting")
pitcher()
print("program executed")
print("program executed")

0 comments on commit 0ff695e

Please sign in to comment.