Click here to Skip to main content
15,889,116 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionMifare Ultralight Pin
chahthuranga15-Jun-14 18:56
chahthuranga15-Jun-14 18:56 
QuestionRe: Mifare Ultralight Pin
Richard MacCutchan15-Jun-14 21:39
mveRichard MacCutchan15-Jun-14 21:39 
QuestionSSL+websocket or SSL+socket.io Pin
Member 1088174512-Jun-14 20:47
Member 1088174512-Jun-14 20:47 
SuggestionRe: SSL+websocket or SSL+socket.io Pin
Richard MacCutchan12-Jun-14 20:59
mveRichard MacCutchan12-Jun-14 20:59 
QuestionHow to convert .WAV to .CSV and .CSV to .WAV Pin
Austin_Cpp11-Jun-14 21:53
Austin_Cpp11-Jun-14 21:53 
SuggestionRe: How to convert .WAV to .CSV and .CSV to .WAV Pin
«_Superman_»11-Jun-14 22:30
professional«_Superman_»11-Jun-14 22:30 
AnswerRe: How to convert .WAV to .CSV and .CSV to .WAV Pin
CPallini11-Jun-14 22:40
mveCPallini11-Jun-14 22:40 
GeneralRe: How to convert .WAV to .CSV and .CSV to .WAV Pin
Austin_Cpp12-Jun-14 4:26
Austin_Cpp12-Jun-14 4:26 
Here is the only code I can find for writing a .Wav file. This is python which I know nothing about. I have .csv files of data that when plotted draw a mandala. I want to save the same file to a .wav format so I can play the mandala as sound. Is writing a wav file possible with C++ code or do I need a library?



https://gist.github.com/Pretz/1773870

#!/usr/bin/python

import wave
import numpy
import struct
import sys
import csv
from scikits.samplerate import resample

def write_wav(data, filename, framerate, amplitude):
wavfile = wave.open(filename, "w")
nchannels = 1
sampwidth = 2
framerate = framerate
nframes = len(data)
comptype = "NONE"
compname = "not compressed"
wavfile.setparams((nchannels,
sampwidth,
framerate,
nframes,
comptype,
compname))
print("Please be patient whilst the file is written")
frames = []
for s in data:
mul = int(s * amplitude)
# print "s: %f mul: %d" % (s, mul)
frames.append(struct.pack('h', mul))
# frames = (struct.pack('h', int(s*self.amp)) for s in sine_list)
frames = ''.join(frames)
for x in xrange(0, 7200):
wavfile.writeframes(frames)
wavfile.close()
print("%s written" %(filename))


if __name__ == "__main__":
if len(sys.argv) <= 1:
print "You must supply a filename to generate"
exit(-1)
for fname in sys.argv[1:]:
data = []
for time, value in csv.reader(open(fname, 'U'), delimiter=','):
try:
data.append(float(value))
except ValueError:
pass # Just skip it
print "Generating wave file from %d samples" % (len(data),)
arr = numpy.array(data)
# Normalize data
arr /= numpy.max(numpy.abs(data))
filename_head, extension = fname.rsplit(".", 1)
# Resample normalized data to 44.1 kHz
target_samplerate = 44100
sampled = resample(arr, target_samplerate/100000.0, 'sinc_best')
write_wav(sampled, filename_head + ".wav", 100000, 32700)
GeneralRe: How to convert .WAV to .CSV and .CSV to .WAV Pin
CPallini12-Jun-14 5:18
mveCPallini12-Jun-14 5:18 
AnswerRe: How to convert .WAV to .CSV and .CSV to .WAV Pin
jschell12-Jun-14 8:36
jschell12-Jun-14 8:36 
QuestionMFC function inside browser Pin
HungryCPPDev11-Jun-14 20:17
HungryCPPDev11-Jun-14 20:17 
QuestionCan i set the scroll bar of window by clicking on the menu?? Pin
sachanratnesh11-Jun-14 0:52
sachanratnesh11-Jun-14 0:52 
AnswerRe: Can i set the scroll bar of window by clicking on the menu?? Pin
Richard MacCutchan11-Jun-14 1:27
mveRichard MacCutchan11-Jun-14 1:27 
QuestionError in Visual 2012 Running an MFC apps Pin
Member 1044615711-Jun-14 0:32
Member 1044615711-Jun-14 0:32 
AnswerRe: Error in Visual 2012 Running an MFC apps Pin
Jochen Arndt11-Jun-14 0:50
professionalJochen Arndt11-Jun-14 0:50 
GeneralRe: Error in Visual 2012 Running an MFC apps Pin
Member 1044615712-Jun-14 10:37
Member 1044615712-Jun-14 10:37 
QuestionConversion of JSON to XML using C++ (need for MFC application) Pin
sma123#10-Jun-14 21:19
sma123#10-Jun-14 21:19 
AnswerRe: Conversion of JSON to XML using C++ (need for MFC application) Pin
Richard MacCutchan10-Jun-14 21:36
mveRichard MacCutchan10-Jun-14 21:36 
GeneralRe: Conversion of JSON to XML using C++ (need for MFC application) Pin
sma123#10-Jun-14 22:05
sma123#10-Jun-14 22:05 
GeneralRe: Conversion of JSON to XML using C++ (need for MFC application) Pin
CPallini10-Jun-14 23:11
mveCPallini10-Jun-14 23:11 
AnswerRe: Conversion of JSON to XML using C++ (need for MFC application) Pin
CPallini10-Jun-14 21:58
mveCPallini10-Jun-14 21:58 
QuestionGame Programming Book Uses C and Asm How do I build these programs Pin
Member 1087548110-Jun-14 2:48
Member 1087548110-Jun-14 2:48 
AnswerRe: Game Programming Book Uses C and Asm How do I build these programs Pin
Maximilien10-Jun-14 3:33
Maximilien10-Jun-14 3:33 
AnswerRe: Game Programming Book Uses C and Asm How do I build these programs Pin
Richard MacCutchan10-Jun-14 4:40
mveRichard MacCutchan10-Jun-14 4:40 
GeneralRe: Game Programming Book Uses C and Asm How do I build these programs Pin
Member 1087548110-Jun-14 5:55
Member 1087548110-Jun-14 5:55 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.