Click here to Skip to main content
15,926,858 members
Home / Discussions / Algorithms
   

Algorithms

 
GeneralRe: conversion of jpg to data ie. txt Pin
Rilhas30-Jan-07 12:46
Rilhas30-Jan-07 12:46 
QuestionRe: conversion of jpg to data ie. txt Pin
Maximilien5-Jan-07 5:40
Maximilien5-Jan-07 5:40 
AnswerRe: conversion of jpg to data ie. txt Pin
Lowki8-Jan-07 1:51
Lowki8-Jan-07 1:51 
GeneralRe: conversion of jpg to data ie. txt Pin
Jeremy Falcon31-Jan-07 6:03
professionalJeremy Falcon31-Jan-07 6:03 
QuestionMoving window along a cosine path Pin
Tommy Svensson28-Dec-06 4:50
Tommy Svensson28-Dec-06 4:50 
AnswerRe: Moving window along a cosine path Pin
Kacee Giger28-Dec-06 7:52
Kacee Giger28-Dec-06 7:52 
Questionhow to change wave file frequency Pin
hserver25-Dec-06 21:37
hserver25-Dec-06 21:37 
AnswerRe: how to change wave file frequency Pin
Rilhas22-Jan-07 12:57
Rilhas22-Jan-07 12:57 
Hi,

You ask a very general question, so, to limit the possibilities, you must define more precisely your objective and any limitations:

1) Is your signal comfortably sampled, or is it on the limits? For example, a 44.1 KHz sampling rate has a signal limit of about 21 Khz or so, so these signals do not "fit inside" the sampling rate comfortably. If, on the other hand, you sampled a 10 KHz sound (voice) with a 44.1 KHz then it fits comfortably.

2) Is the new frequency always a multiple/submultiple of the original? Or is it arbitrarily diferent? If arbitrarily diferent then is it static or variable? For example, starting at 2:1 ratio and ending at 3:1 ratio?

3) Is the resulting quality very important? Or is it mathematical accuracy more important? Better accuracy implies better quality of course, but if you just want your resulting file to sound good then you may allow lower accuracy to simplify the algorithm.

4) Will you be able to use floating point? Or are you constrainded to using integers? Is performance important? If so, how many samples do you want to process per second? Or what is the real-time factor? If performance is very important then MMX/SSE may be necessary, that is why I ask.

5) Do you want to keep the same precision or can you use more precision in the result? For example, your source samples may be 16-bit and you may want the result in 32-bit floating point. If you want the sound to simply sound ok then I sugest you keep the original precision. If you want true mathematical accuracy then, in general, you should use higher precision than the original.


A lot more question could be asked before determining exactly what you want. Anyway, let me point out the most relevant aspects of the algorithm you need:

a) If the frequency is to be raised then the signal must be filtered to remove the frequencies that, after the frequency change, exceed half of the sampling rate. Variable filters (or parametric filters) may have a lowered performance and may be more complex to design.

b) After filtering the signal you generaly need to expand it into a new buffer (if the frequency is lowered), or, if the frequency is raised then you may do it in place. The most general form is to simply allocate a new buffer for both cases of lowering and raising the frequency.

c) Now that you have a destination buffer you must compute the new sample values. There are many ways to acomplish this, but maybe 2 can be considered interesting: linear interpolation and "real" interpolation. The first is simple but not very accurate, the second is complex but very accurate.



If you need more help on any of the questions (1->5) or steps (a->c) above then don't hesitate to ask. I kept the answer general while I don't know exactly what you want, but when you tell me what you want then I can give you a detailed algorithm.

I hope this helps,
Rilhas
QuestionPuzzle Challenge Site Pin
Are Jay22-Dec-06 21:47
Are Jay22-Dec-06 21:47 
AnswerRe: Puzzle Challenge Site Pin
PIEBALDconsult26-Dec-06 6:47
mvePIEBALDconsult26-Dec-06 6:47 
GeneralRe: Puzzle Challenge Site Pin
Luc Pattyn26-Dec-06 7:38
sitebuilderLuc Pattyn26-Dec-06 7:38 
GeneralRe: Puzzle Challenge Site Pin
PIEBALDconsult26-Dec-06 9:28
mvePIEBALDconsult26-Dec-06 9:28 
GeneralRe: Puzzle Challenge Site Pin
Luc Pattyn26-Dec-06 9:47
sitebuilderLuc Pattyn26-Dec-06 9:47 
GeneralRe: Puzzle Challenge Site Pin
PIEBALDconsult26-Dec-06 10:21
mvePIEBALDconsult26-Dec-06 10:21 
GeneralRe: Puzzle Challenge Site Pin
Luc Pattyn26-Dec-06 11:41
sitebuilderLuc Pattyn26-Dec-06 11:41 
GeneralRe: Puzzle Challenge Site Pin
Are Jay26-Dec-06 18:01
Are Jay26-Dec-06 18:01 
GeneralRe: Puzzle Challenge Site Pin
PIEBALDconsult27-Dec-06 8:20
mvePIEBALDconsult27-Dec-06 8:20 
AnswerRe: Puzzle Challenge Site Pin
Luc Pattyn26-Dec-06 8:00
sitebuilderLuc Pattyn26-Dec-06 8:00 
GeneralRe: Puzzle Challenge Site Pin
Are Jay26-Dec-06 19:00
Are Jay26-Dec-06 19:00 
GeneralRe: Puzzle Challenge Site Pin
Luc Pattyn27-Dec-06 0:34
sitebuilderLuc Pattyn27-Dec-06 0:34 
GeneralRe: Puzzle Challenge Site Pin
Are Jay27-Dec-06 3:30
Are Jay27-Dec-06 3:30 
AnswerRe: Puzzle Challenge Site Pin
PIEBALDconsult27-Dec-06 8:54
mvePIEBALDconsult27-Dec-06 8:54 
QuestionAssist about 3d modelling Pin
ms raj21-Dec-06 23:50
ms raj21-Dec-06 23:50 
AnswerRe: Assist about 3d modelling Pin
prasad_som22-Dec-06 0:23
prasad_som22-Dec-06 0:23 
AnswerRe: Assist about 3d modelling Pin
micmanos27-Dec-06 5:50
micmanos27-Dec-06 5:50 

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.