🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.multimedia
Article #1251

Wave problem

#1251
From: Mike
Date: Sat, 14 Apr 2001 15:40
26 lines
1473 bytes
Hi!

What is wrong with this code? It should generate raw wave data (8-bit,
48.000 Hz, unsigned) - triangular wave, but it doesn't. It generates
something
like that, but with some strange offsets.

=========================================
#include <math.h>
#include <iostream.h>
unsigned long int freq = 1;
unsigned long int i;
main() {
 FILE *output_file;
 output_file = fopen("test.raw", "wb");
 for (i = 0; i < (freq * 48000); ++i) {
  fputc(int(256.0 * fabsl(fmodl((2.0 * i * freq) / 48000.0 - 0.5, 2.0) -

1.0) - 128.0), output_file);
 }
 fclose(output_file);
}
=========================================


Mike
Technical Details
Message-ID: <3AD86F5F.3AAE3240@yahoo.com>
Path: arc1-ca.pugleaf.net!supernews.google.com!sn-xit-03!supernews.com!logbridge.uoregon.edu!news.maxwell.syr.edu!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!dnews

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10d0fc,e277abd6f92e07ad,start
X-Google-Attributes: gid10d0fc,public
X-Google-ArrivalTime: 2001-04-14 08:44:03 PST
Message-ID: <3AD86F5F.3AAE3240@yahoo.com>
Date: Sat, 14 Apr 2001 17:40:15 +0200
From: Mike <ppagee@yahoo.com>
Organization: Anonymous
X-Mailer: Mozilla 4.75 [en] (Win95; U)
X-Accept-Language: en,sl
MIME-Version: 1.0
Newsgroups: borland.public.cppbuilder.multimedia
Subject: Wave problem
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: 194.249.6.193
X-Trace: dnews 987262867 194.249.6.193 (14 Apr 2001 08:41:07 -0700)
Lines: 27
Path: arc1-ca.pugleaf.net!supernews.google.com!sn-xit-03!supernews.com!logbridge.uoregon.edu!news.maxwell.syr.edu!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!dnews