Click here to Skip to main content
15,917,652 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionWriting to same console in MFC Pin
sma123#18-Jun-14 8:04
sma123#18-Jun-14 8:04 
QuestionRe: Writing to same console in MFC Pin
Richard MacCutchan18-Jun-14 22:23
mveRichard MacCutchan18-Jun-14 22:23 
AnswerRe: Writing to same console in MFC Pin
Albert Holguin26-Jun-14 4:50
professionalAlbert Holguin26-Jun-14 4:50 
QuestionIP spoofing Pin
Member 1089143217-Jun-14 19:33
Member 1089143217-Jun-14 19:33 
AnswerRe: IP spoofing Pin
Richard MacCutchan17-Jun-14 22:11
mveRichard MacCutchan17-Jun-14 22:11 
AnswerRe: IP spoofing Pin
CPallini18-Jun-14 0:02
mveCPallini18-Jun-14 0:02 
AnswerRe: IP spoofing Pin
jschell18-Jun-14 11:02
jschell18-Jun-14 11:02 
SuggestionRe: IP spoofing Pin
David Crow19-Jun-14 6:58
David Crow19-Jun-14 6:58 
GeneralRe: IP spoofing Pin
Albert Holguin26-Jun-14 4:52
professionalAlbert Holguin26-Jun-14 4:52 
QuestionHow to send a NULL through a Socket in Borland C++ Pin
Kavan Rathnayake16-Jun-14 15:08
Kavan Rathnayake16-Jun-14 15:08 
AnswerRe: How to send a NULL through a Socket in Borland C++ Pin
PIEBALDconsult16-Jun-14 15:34
mvePIEBALDconsult16-Jun-14 15:34 
GeneralRe: How to send a NULL through a Socket in Borland C++ Pin
Kavan Rathnayake16-Jun-14 15:59
Kavan Rathnayake16-Jun-14 15:59 
AnswerRe: How to send a NULL through a Socket in Borland C++ Pin
«_Superman_»16-Jun-14 19:49
professional«_Superman_»16-Jun-14 19:49 
AnswerRe: How to send a NULL through a Socket in Borland C++ Pin
David Crow17-Jun-14 3:22
David Crow17-Jun-14 3:22 
AnswerRe: How to send a NULL through a Socket in Borland C++ Pin
jschell17-Jun-14 8:49
jschell17-Jun-14 8:49 
QuestionGantt chart control using MFC Pin
sma123#16-Jun-14 2:08
sma123#16-Jun-14 2:08 
AnswerRe: Gantt chart control using MFC Pin
Richard MacCutchan16-Jun-14 3:27
mveRichard MacCutchan16-Jun-14 3:27 
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)

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.