Python Forum
From theory to practice
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
From theory to practice
#1
Hi,

I am rather new to the whole python thing... that being said I have dabble in several areas of signal processing. I am an engineering student and had to do a few projects for my courses. The way these projects worked was pretty much always the same you took what your professor showed you in the lecture and altered it...
one of my problems is this: the examples from the lectures generally included a huge amount of "toolset" that just made everything work (I assume) so that you could focus on actually creating filters... What I am looking for is not a magical line of code that fixes everything... I want to understand what I am doing...

So... now I wanted to do a project of my own and from scratch... Nothing too complicated for now: Read in a .wav-file, make it mono (if applicable), reduce the bitdepth to 8 bit (maybe even less), write a new file. The signal related actions aren't really the problem... but I just cannot get my head around how python does things. At this point I am not even sure where my problem is...

So here is what I have so far:
import numpy as np
import time, wave, pyaudio
import scipy.io.wavfile

bitdepth = 8
input_file = "16AGR_The_Hunted_Percy(OUT).wav"
channles = 0

stepsize = (1.0 - (-1.0))/(2**bitdepth)

print "Reading file"
original = scipy.io.wavfile.read(input_file)
audio = original[1]

print audio
This gives me this output:
Output:
Reading file [[-1 -2]  [ 1  1]  [-4 -3]  ...,  [ 4 -2]  [-4  2]  [ 4 -1]]
So from what I have gathered scipy.io.wavfile.read returns a list with three objects the second of which should contain the audio data (in this case stereo). Since there are about 200k samples in the file the output does not show all of them.. fine.. but what is that? [-1 -2]?  That is no audio sample I have ever seen... and all integers? I have no idea what I am seeing here... and at this point no idea where to look for answers...
Reply


Messages In This Thread
From theory to practice - by bertibott - Feb-24-2017, 01:12 PM
RE: From theory to practice - by stranac - Feb-24-2017, 01:51 PM
RE: From theory to practice - by zivoni - Feb-24-2017, 02:19 PM
RE: From theory to practice - by bertibott - Feb-24-2017, 03:53 PM
RE: From theory to practice - by zivoni - Feb-24-2017, 04:55 PM
RE: From theory to practice - by Mekire - Feb-24-2017, 04:36 PM
RE: From theory to practice - by bertibott - Feb-24-2017, 04:51 PM
RE: From theory to practice - by zivoni - Feb-24-2017, 05:22 PM
RE: From theory to practice - by Mekire - Feb-24-2017, 05:07 PM
RE: From theory to practice - by bertibott - Feb-24-2017, 05:46 PM
RE: From theory to practice - by sparkz_alot - Feb-24-2017, 08:32 PM
RE: From theory to practice - by zivoni - Feb-24-2017, 09:37 PM
RE: From theory to practice - by sparkz_alot - Feb-25-2017, 12:10 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  .xls processing with Pandas - my struggle moving from theory to practical use prolle 0 1,554 May-21-2020, 06:57 PM
Last Post: prolle
  Help with Data Match Theory randor 2 2,030 Dec-25-2019, 05:57 PM
Last Post: randor

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020