This repository has been archived by the owner on Jun 17, 2019. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f31e87c
commit 27f1cab
Showing
6 changed files
with
120 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
|
||
MacGui/SNDCNV/SNDCNV/SNDCNV-Prefix.pch | ||
|
||
MacGui/SNDCNV/SNDCNV.xcodeproj/project.pbxproj | ||
|
||
MacGui/SNDCNV/SNDCNV.xcodeproj/project.pbxproj | ||
|
||
MacGui/SNDCNV/SNDCNV.xcodeproj/project.pbxproj | ||
|
||
.DS_Store |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
import SNDCNVclassified | ||
from Tkinter import * | ||
import tkFileDialog | ||
import tkMessageBox | ||
import sys | ||
|
||
class SNDCNV_GUI: | ||
|
||
inputFile = "" | ||
outputFile = "" | ||
sndcnv = SNDCNVclassified | ||
|
||
def null(): | ||
pass | ||
|
||
def __init__(self, master): | ||
frame = Frame(height=90, width=140) | ||
frame.pack_propagate(0) | ||
frame.pack() | ||
|
||
inputFile = "" | ||
outputFile = "" | ||
|
||
SNDCNVLabel = Label(text="|| SNDCNV ||") | ||
SNDCNVLabel.pack() | ||
|
||
goButton = Button(frame, text="Set Input File", command=self.inputFileCallback(1)) | ||
goButton.pack() | ||
|
||
goButton = Button(frame, text="Set Output File", command=self.inputFileCallback(2)) | ||
goButton.pack() | ||
|
||
goButton = Button(frame, text="Go", command=null) | ||
goButton.pack() | ||
|
||
def inputFileCallback(self,e): | ||
a = tkFileDialog | ||
if(e==1): | ||
fileName = a.askopenfilename()[1] | ||
if(len(fileName <= 2)): | ||
self.sndcnv.outputFile(fileName) | ||
else: | ||
print("File Not Valid") | ||
elif(e==2): | ||
fileName = a.askopenfilename()[1] | ||
if(len(fileName <= 2)): | ||
self.sndcnv.outputFile(fileName) | ||
else: | ||
print("File Not Valid") | ||
|
||
root = Tk() | ||
sndcnv = SNDCNV_GUI(root) | ||
root.mainloop() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
import wave, aifc, sys, sndhdr | ||
|
||
def __init__(): | ||
inputFileLocation = "" | ||
outputFileLocation = "" | ||
|
||
def inputFile(a): | ||
inputFileLocation = a | ||
|
||
def outputFile(a): | ||
outputFileLocation = a | ||
|
||
def convert(): | ||
samplePerCycle = 1 | ||
"""Converts between wav and aiff files""" | ||
if sndhdr.what(inputFileLocation)[0] == 'wav': | ||
#from Wav to Aiff. | ||
input = wave.open(inputFileLocation, 'r') | ||
output = aifc.open(outputFileLocation, 'w') | ||
|
||
elif sndhdr.what(inputFileLocation)[0] == 'aiff': | ||
#from Aiff to Wav | ||
input = aifc.open(inputFileLocation, 'r') | ||
output = wave.open(outputFileLocation, 'w') | ||
|
||
nframes = input.getnframes() | ||
|
||
output.setnchannels(input.getnchannels()) | ||
output.setframerate(input.getframerate()) | ||
output.setsampwidth(input.getsampwidth()) | ||
|
||
i = 1 | ||
dataset = [] | ||
|
||
for i in range(0, nframes, samplePerCycle): | ||
input.setpos(i) | ||
dataval = input.readframes(samplePerCycle) | ||
dataset.append(dataval) | ||
|
||
#=========================================== | ||
#Implement output(nframes) == input(nframes) | ||
#=========================================== | ||
#if (nframes % samplePerCycle < samplePerCycle): | ||
# if (nframes % samplePerCycle != 0): | ||
# samplePerCycle = nframes % samplePerCycle | ||
|
||
valuestr = ''.join(dataset) | ||
output.writeframes(valuestr) | ||
|
||
input.close() | ||
output.close() | ||
|
||
if __name__ == "__main__": | ||
import sys | ||
inputFile = sys.argv[1] | ||
outputFile = sys.argv[2] | ||
convert(inputFile,outputFile) |
Binary file not shown.
Binary file not shown.
Binary file not shown.